<?php
namespace app\index\controller;
use \app\index\controller\Base;
use \think\Db;
class Cases extends Base
{
    public function index()
    {
		$tuijian = Db::name('tuijian')->alias("t")->join([["lawyer_case l","t.lid=l.id","LEFT"]])->field(["t.id","t.lid","l.title"])->select();
        $this->assign('tuijian',$tuijian);
		$lianxiren=Db::name("lianxiren")->find();
		$this->assign("lianxiren",$lianxiren);
        $seo=Db::name("seo")->where("class","case")->find();
        $this->assign("seo",$seo);
    	$this->assign('menu','3');
        $where['state']=["=","1"];
		$type=Request()->param("type");
		if($type!="") $where["type"]=["=",$type];
		$cases=Db::name('lawyer_case')->where($where)->order("id","desc")->paginate(10,false,['query'=>request()->Post()]);
		$this->assign("cases",$cases);
    	// $this->assign('_title','新闻列表');
        return $this->fetch();
    }

    //新闻详情页
    public function info(){
		$seo=Db::name("seo")->where("class","case")->find();
        $this->assign("seo",$seo);
    	$this->assign('menu','3');
    	//新闻
        $cases=Db::name('lawyer_case')->where('id',$this->request->param('id'))->find();
        $this->assign('cases',$cases);
		$tuijian = Db::name('tuijian')->alias("t")->join([["lawyer_case l","t.lid=l.id","LEFT"]])->field(["t.id","t.lid","l.title"])->select();
        $this->assign('tuijian',$tuijian);
		$lianxiren=Db::name("lianxiren")->find();
		$this->assign("lianxiren",$lianxiren);
    	// $this->assign('menu','3');
    	// $this->assign('_title',"新闻详情");
        return $this->fetch();
    }
}
